
import 'dart:convert';
import 'package:ichinesereader/models/common/Settings.dart';

List<StudentClass> studentClassFromJson(String str) => List<StudentClass>.from(
    json.decode(str).map((x) => StudentClass.fromJson(x)));

String studentClassToJson(List<StudentClass> data) =>
    json.encode(List<dynamic>.from(data.map((x) => x.toJson())));

class StudentClass {
  StudentClass({
    this.classId,
    this.className,
    this.level,
    this.schoolAdmin,
    this.settings,
    this.teacherUserNames,
    this.viewReport,
  });

  String? classId;
  String? className;
  String? level;
  String? schoolAdmin;
  Settings? settings;
  List<String>? teacherUserNames;
  bool? viewReport;

  factory StudentClass.fromJson(Map<String, dynamic> json) => StudentClass(
        classId: json["classId"],
        className: json["className"],
        level: json["level"],
        schoolAdmin: json["schoolAdmin"],
        settings: Settings.fromJson(json["settings"]),
        teacherUserNames:
            List<String>.from(json["teacherUserNames"].map((x) => x)),
        viewReport: json["viewReport"],
      );

  Map<String, dynamic> toJson() => {
        "classId": classId,
        "className": className,
        "level": level,
        "schoolAdmin": schoolAdmin,
        "settings": settings?.toJson(),
        "teacherUserNames": List<dynamic>.from(teacherUserNames!.map((x) => x)),
        "viewReport": viewReport,
      };
}
